import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
   {
    title: '编码',
    align:"center",
    dataIndex: 'code'
   },
   {
    title: '名称',
    align:"center",
    dataIndex: 'name'
   },
/*   {
    title: '说明',
    align:"center",
    dataIndex: 'note'
   },
   {
    title: '状态',
    align:"center",
    dataIndex: 'status'
   },*/
   {
    title: '类型',
    align:"center",
    dataIndex: 'type',
     customRender:({text})=>{
       if(text=='datainfo'){
           return "表格"
       }
       if(text=='chartinfo'){
          return "图表"
       }
       if(text=='printinfo'){}
           return '打印';
     }
   },
   {
    title: 'json字符串',
    align:"center",
    dataIndex: 'previewurl',
     ifShow:false,
   },
   {
    title: '请求地址',
    align:"center",
    dataIndex: 'apiUrl',
     ifShow:false,
   },
   {
    title: '缩略图',
    align:"center",
    dataIndex: 'thumb',
     ifShow:false,
   },
   {
    title: '删除标识0-正常,1-已删除',
    align:"center",
    dataIndex: 'delFlag',
     ifShow:false,
   },
   {
    title: '请求方法0-get,1-post',
    align:"center",
    dataIndex: 'apiMethod',
     ifShow:false,
   },
   {
    title: '请求编码',
    align:"center",
    dataIndex: 'apiCode',
     ifShow:false,
   },
   {
    title: '浏览次数',
    align:"center",
    dataIndex: 'viewCount'
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
	{
      label: "名称",
      field: 'name',
      component: 'JInput',
      colProps: {span: 6},
 	},
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '编码',
    field: 'code',
    component: 'Input',
  },
  {
    label: '名称',
    field: 'name',
    component: 'Input',
  },
  {
    label: '说明',
    field: 'note',
    component: 'Input',
  },
  {
    label: '状态',
    field: 'status',
    component: 'Input',
  },
  {
    label: '类型',
    field: 'type',
    component: 'Input',
  },
  {
    label: 'json字符串',
    field: 'preview_url',
    component: 'Input',
  },
  {
    label: '请求地址',
    field: 'apiUrl',
    component: 'Input',
  },
  {
    label: '缩略图',
    field: 'thumb',
    component: 'InputTextArea',
  },
  {
    label: '删除标识0-正常,1-已删除',
    field: 'delFlag',
    component: 'InputNumber',
  },
  {
    label: '请求方法0-get,1-post',
    field: 'apiMethod',
    component: 'Input',
  },
  {
    label: '请求编码',
    field: 'apiCode',
    component: 'Input',
  },
  {
    label: '浏览次数',
    field: 'viewCount',
    component: 'InputNumber',
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];



/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}
